package lab01;

/**
 * Created by JAVA on 2017/9/30.
 */
public class Test05 {
     public static void main(String[] args) {
         int i=1, n = 10, sum1 = 0, sum2 = 0, sum3 = 0;
      /* for (i = 1; i <= n; i++) {
             sum1 = sum1 + i;
         }
         System.out.println(sum1 );*/
         //for循环求和
        /*while (i <= n) {
             sum2 = i + sum2;
             i++;
         }
         System.out.println(sum2 );*/
         //while循环求和
         do {
             sum3 = sum3 + i;
             i++;
         } while (i <= n);
         System.out.println(sum3 );
         //do...while循环求和
     }
}



